package com.nbsaas.boot.product.rest.convert;

import com.nbsaas.boot.product.data.entity.ProductSpecValue;
import com.nbsaas.boot.product.api.domain.simple.ProductSpecValueSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 规格值-列表对象转换器
*/

public class ProductSpecValueSimpleConvert implements Converter<ProductSpecValueSimple, ProductSpecValue> {




@Override
public ProductSpecValueSimple convert(ProductSpecValue source) {
    ProductSpecValueSimple result = new ProductSpecValueSimple();


                try {
                    if(source.getSpec()!=null){
                        result.setSpecName(source.getSpec().getName());
                    }
                } catch (Exception ignored) { }

                result.setProductId(source.getProductId());
                result.setName(source.getName());
                result.setId(source.getId());

               try {
                   if(source.getSpec()!=null){
                       result.setSpec(source.getSpec().getId());
                   }
                } catch (Exception ignored) { }



    return result;
}

}